<template>
  <el-card style="height: 500px;margin-top: 15px">
    <span style="dislay: inline-block;padding: 5px 0;font-size: 24px;">绩效指数</span>
    <el-divider />
    <div ref="myEchart" class="echart" />
  </el-card>
</template>

<script>
// var echarts = require('echarts')
// 按需引入
import * as echarts from 'echarts/core'
import { TitleComponent, LegendComponent } from 'echarts/components'
import { RadarChart } from 'echarts/charts'
import { CanvasRenderer } from 'echarts/renderers'

echarts.use([TitleComponent, LegendComponent, RadarChart, CanvasRenderer])

export default {
  name: 'WorkRadar',
  mounted() {
    const myChart = echarts.init(this.$refs.myEchart)
    // 绘制图表
    myChart.setOption({
      title: {
        text: '个人工作绩效表'
      },
      radar: {
        // shape: 'circle',
        indicator: [
          { name: '考勤', max: 100 },
          { name: '工资', max: 100 },
          { name: '代码质量', max: 100 },
          { name: '工作积极性', max: 100 },
          { name: '加班时长', max: 100 },
          { name: 'bug数量', max: 100 }
        ]
      },
      series: [
        {
          name: 'Budget vs spending',
          type: 'radar',
          data: [
            {
              value: [80, 20, 15, 69, 70, 80]
            },
            {
              value: [0, 100, 100, 0, 0, 0]
            }
          ]
        }
      ]
    })
    // 雷达图的自适应
    myChart.resize()
  }
}
</script>

<style>
.echart{
  width: 600px;
  height: 400px;
  margin-top: 20px;
}

</style>
